import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s=scanner.nextLine();
        if(s==null||s.length()==1){
            System.out.println(s);
            return;
        }
        String s1=s.charAt(0)+"";
        int left;
        int right;
        for(int i=0;i<s.length();i++){
             left=i;
             right=s.lastIndexOf(s.charAt(left));
            while (!(right==-1||right==left)) {
                    int a = left;
                    int b = right;
                    while (a < b) {
                        if (s.charAt(a) == s.charAt(b)) {
                            a++;
                            b--;
                        } else break;
                    }
                    if (a >= b && (s1.length() < right - left + 1)) {
                        s1 = s.substring(left, right + 1);
                    }
                right=s.lastIndexOf(s.charAt(left),right-1);
            }
        }
        System.out.println(s1);
    }
    public static void main4(String[] args) {
        long Max=(long) (Math.pow(10,9)+7);
        int n=4;
        long[] dp=new long[n+1];
        dp[1]=1;dp[2]=2;dp[3]=4;
       for(int i=4;i<=n;i++){
           dp[i]= (dp[i-3]%Max+dp[i-2]%Max+dp[i-1]*1%Max)%Max;
       }
       System.out.println(dp[n]);
    }
    public static void main3(String[] args) {
        List<List<Integer>> lists=new ArrayList<>();
        int numRows=5;
        List<Integer> list1=new ArrayList<>();
        list1.add(1);
        lists.add(list1);
        if(numRows==1) {
            System.out.println(Arrays.toString(lists.toArray()));
            return;
        }
        List<Integer> list2=new ArrayList<>();
        list2.add(1);
        list2.add(1);
        lists.add(list2);
        if(numRows==2) {
            System.out.println(Arrays.toString(lists.toArray()));
            return;
        }
        for(int i=3;i<=numRows;i++){
            List<Integer> preList=lists.get(lists.size()-1);
            List<Integer> nextList=new ArrayList<>();
            nextList.add(1);
            for(int j=1;j<=i-2;j++){
                nextList.add(preList.get(j)+preList.get(j-1));
            }
            nextList.add(1);
            lists.add(nextList);
        }
        System.out.println(Arrays.toString(lists.toArray()));
    }
    public static boolean det(char c){
        if('a'<=c&&c<='z') return true;
        else if('0'<=c&&c<='9') return true;
        return false;
    }

    public static void main2(String[] args) {
        String s="0P".toLowerCase(Locale.ROOT);
       //if(s=null) return;
        int lift=0;
        int right=s.length()-1;
        while (lift<right){
            if(det(s.charAt(lift))&&det(s.charAt(right))){
                if(s.charAt(lift)!=s.charAt(right)){
                    System.out.println("0");
                    return;
                }
                else {
                    lift++;right--;
                }
            }
            if(!det(s.charAt(lift))) lift++;
            if (!det(s.charAt(right))) right--;
        }
        System.out.println(1);
    }
    public static String intToRoman(int num) {
        Scanner sc=new Scanner(System.in);
        String s;
        HashMap<Integer,Character> hash=new HashMap<>();
        hash.put(1,'I');
        hash.put(5,'V');
        hash.put(10,'X');
        hash.put(50,'L');
        hash.put(100,'C');
        hash.put(500,'D');
        hash.put(1000,'M');
        String ns=num+"";
        int a=ns.length();
        for(int i=a;i>0;i--){
            int x=num/(int) Math.pow(10,i);

        }
        return " ";
    }


    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println(intToRoman(sc.nextInt()));
    }
}
